package com.htl.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * 差集测试
 */
public class ListCollect {
    public static void main(String[] args) {
        List<uFace> one = new ArrayList<>();
        List<uFace> two = new ArrayList<>();
        List<uFace> three = new ArrayList<>();

        one.add(new uFace(1,1,"张三1"));
        one.add(new uFace(1,2,"张三2"));//本地
        one.add(new uFace(1,3,"李四3"));
        one.add(new uFace(1,4,"李四4"));
        //one.add(new uFace(1,5,"李四5"));

//        two.add(new uFace(1,2,"张三2"));//1
//        two.add(new uFace(1,3,"张三3"));//门禁2
//        two.add(new uFace(1,4,"李四4"));//3

//        two.add(new uFace(1,5,"张三5"));//4
        //two.add(new uFace(1,2,"张三2"));//1
        two.add(new uFace(1,3,"张三3"));//门禁2
        two.add(new uFace(1,4,"李四4"));//
        two.add(new uFace(1,5,"张三5"));//

        three = one.stream().filter(
                a -> !two.stream().map(b -> b.getFaceId()).
                        collect(Collectors.toList()).contains(a.getFaceId())
        ).collect(Collectors.toList());

//        three = one.stream().filter(
//            a -> !two.stream().map(b -> b.getFaceId()).
//                collect(Collectors.toList()).contains(a.getFaceId())
//        ).collect(Collectors.toList());
        System.out.println(one);
        System.out.println(two);
        System.out.println(three);

    }
}
